Conversation
…bleNilStreamValues to enable compatible default behaviour
|
👋 brunotm, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
|
There was a problem hiding this comment.
Pull request overview
Renames the LLO channel definition flag controlling nil stream-value handling to use a “disable” semantics and JSON field name, aiming to make the default behavior “nil values allowed” and align naming with intended meaning.
Changes:
- Rename
ChannelDefinition.AllowNilStreamValuestoChannelDefinition.DisableNilStreamValuesand update equality logic accordingly. - Update JSON serialization expectations/tests to use the new
disableNilStreamValuesfield and inverted boolean values.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
pkg/types/llo/types.go |
Renames exported struct field + JSON tag; updates Equals to compare the new field. |
pkg/types/llo/types_test.go |
Updates serialization/value/equality tests to expect disableNilStreamValues in JSON and struct literals. |
Comments suppressed due to low confidence (1)
pkg/types/llo/types_test.go:50
- The serialization round-trip test only covers the new
disableNilStreamValueskey. Since this PR changes the JSON field name, consider adding a test case that unmarshals legacy JSON containingallowNilStreamValuesand verifies it is interpreted equivalently (or explicitly rejected) to avoid silent changes when older payloads are still present.
func Test_ChannelDefinitions_Serialization(t *testing.T) {
inputJSON := `
{
"0": {
"reportFormat": "json",
"streams": [
{"streamId": 1, "aggregator": "median"},
{"streamId": 2, "aggregator": "mode"}
],
"opts": null,
"tombstone": false,
"source": 1,
"disableNilStreamValues": true
},
"1": {
"reportFormat": "evm_premium_legacy",
"streams": [
{"streamId": 1, "aggregator": "median"},
{"streamId": 2, "aggregator": "median"},
{"streamId": 3, "aggregator": "quote"}
],
"opts": {
"expirationWindow": 86400,
"multiplier": "1000000000000000000",
"feedId": "0x0003aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"baseUSDFee": "0.1"
},
"tombstone": false,
"source": 2,
"disableNilStreamValues": false
}
}`
var channelDefinitions ChannelDefinitions
err := json.Unmarshal([]byte(inputJSON), &channelDefinitions)
require.NoError(t, err)
marshaledJSON, err := json.Marshal(channelDefinitions)
require.NoError(t, err)
assert.JSONEq(t, inputJSON, string(marshaledJSON))
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| // DisableNilStreamValues controls whether channels with nil stream values | ||
| // are considered reportable. When true, nil stream values are disabled | ||
| // (channel not reportable until all values present). When false (default), | ||
| // nil stream values are allowed and the report codec needs to handle them accordingly. | ||
| DisableNilStreamValues bool `json:"disableNilStreamValues"` |
This api attribute is still unused so there is no incompatible changes.
Requires
Supports